﻿USE [master]
GO
/****** Object:  Database [Zosnn]    Script Date: 2014/4/29 22:51:59 ******/
CREATE DATABASE [Zosnn]
 CONTAINMENT = NONE
 ON  PRIMARY 
( NAME = N'zosnn', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\zosnn.mdf' , SIZE = 5120KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'zosnn_log', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\zosnn_log.ldf' , SIZE = 2048KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [Zosnn] SET COMPATIBILITY_LEVEL = 110
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Zosnn].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [Zosnn] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [Zosnn] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [Zosnn] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [Zosnn] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [Zosnn] SET ARITHABORT OFF 
GO
ALTER DATABASE [Zosnn] SET AUTO_CLOSE OFF 
GO
ALTER DATABASE [Zosnn] SET AUTO_CREATE_STATISTICS ON 
GO
ALTER DATABASE [Zosnn] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [Zosnn] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [Zosnn] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [Zosnn] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [Zosnn] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [Zosnn] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [Zosnn] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [Zosnn] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [Zosnn] SET  DISABLE_BROKER 
GO
ALTER DATABASE [Zosnn] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [Zosnn] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [Zosnn] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [Zosnn] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [Zosnn] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [Zosnn] SET READ_COMMITTED_SNAPSHOT OFF 
GO
ALTER DATABASE [Zosnn] SET HONOR_BROKER_PRIORITY OFF 
GO
ALTER DATABASE [Zosnn] SET RECOVERY FULL 
GO
ALTER DATABASE [Zosnn] SET  MULTI_USER 
GO
ALTER DATABASE [Zosnn] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [Zosnn] SET DB_CHAINING OFF 
GO
ALTER DATABASE [Zosnn] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) 
GO
ALTER DATABASE [Zosnn] SET TARGET_RECOVERY_TIME = 0 SECONDS 
GO
EXEC sys.sp_db_vardecimal_storage_format N'Zosnn', N'ON'
GO
USE [Zosnn]
GO
/****** Object:  Table [dbo].[Collect]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Collect](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[UserID] [int] NULL,
	[SellerID] [int] NULL,
	[Created] [datetime] NULL,
	[SellerName] [varchar](200) NULL,
 CONSTRAINT [PK_Collect] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Order]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Order](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Created] [datetime] NULL,
	[Status] [nchar](10) NULL,
	[UserID] [int] NULL,
	[SellerID] [int] NULL,
	[OrderNum] [varchar](50) NULL,
	[OrderMoney] [float] NULL,
	[SellerTime] [datetime] NULL,
	[UserTime] [datetime] NULL,
	[OrderInfo] [varchar](200) NULL,
	[Address] [varchar](200) NULL,
	[Tel] [varchar](50) NULL,
 CONSTRAINT [PK_Order] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[OrderInfo]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[OrderInfo](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[ProductID] [int] NULL,
	[OrderID] [int] NULL,
	[Count] [int] NULL,
	[ProductName] [varchar](200) NULL,
	[SmallPic] [varchar](200) NULL,
 CONSTRAINT [PK_Order_Info] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Product]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Product](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[TypeID] [int] NULL,
	[Price] [float] NULL,
	[SellerID] [int] NULL,
	[SmallPic] [varchar](500) NULL,
	[Staus] [bit] NULL,
	[Spec] [varchar](100) NULL,
	[Created] [datetime] NULL,
 CONSTRAINT [PK_Product] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[ProductInfo]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ProductInfo](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Description] [varchar](max) NULL,
	[PicUrl1] [varchar](300) NULL,
	[PicUrl2] [varchar](300) NULL,
	[PicUrl3] [varchar](300) NULL,
	[ProductID] [int] NULL,
 CONSTRAINT [PK_Product_Info] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[ProductType]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductType](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nchar](10) NULL,
	[Created] [datetime] NULL,
	[Sort] [int] NULL,
	[ParentID] [int] NULL,
 CONSTRAINT [PK_Product_Type] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Seller]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Seller](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](200) NULL,
	[Address] [varchar](200) NULL,
	[Tel] [varchar](50) NULL,
	[Description] [varchar](max) NULL,
	[AreaID] [int] NULL,
	[Created] [nchar](10) NULL,
	[LoginName] [varchar](200) NULL,
	[Password] [varchar](50) NULL,
	[Contacts] [varchar](50) NULL,
	[GPSInfo] [varchar](500) NULL,
	[Around] [varchar](200) NULL,
	[Star] [varchar](50) NULL,
 CONSTRAINT [PK_Seller] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[SellerArea]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SellerArea](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[TypeName] [varchar](50) NULL,
	[Created] [datetime] NULL,
	[ParentID] [int] NULL,
	[Location] [varchar](200) NULL,
	[Around] [varchar](50) NULL,
 CONSTRAINT [PK_Seller_Area] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[User]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[User](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](200) NULL,
	[Mobile] [varchar](50) NULL,
	[Password] [varchar](50) NULL,
	[Created] [datetime] NULL,
	[LastLogin] [datetime] NULL,
	[OrderCount] [int] NULL,
	[DealCount] [int] NULL,
	[MobileCode] [varchar](200) NULL,
 CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[UserInfo]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[UserInfo](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Address] [varchar](500) NULL,
	[Tel] [varchar](50) NULL,
	[Position] [varchar](200) NULL,
	[Usually] [bit] NULL,
	[UserID] [int] NULL,
 CONSTRAINT [PK_User_Info] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[WebUser]    Script Date: 2014/4/29 22:51:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[WebUser](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[LoginName] [varchar](200) NULL,
	[Password] [varchar](200) NULL,
	[DisplayName] [varchar](200) NULL,
	[Created] [datetime] NULL,
	[Activation] [bit] NULL,
	[SuperAdmin] [bit] NULL,
 CONSTRAINT [PK_WebUser] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[Collect]  WITH CHECK ADD  CONSTRAINT [FK_Collect_Seller] FOREIGN KEY([SellerID])
REFERENCES [dbo].[Seller] ([ID])
GO
ALTER TABLE [dbo].[Collect] CHECK CONSTRAINT [FK_Collect_Seller]
GO
ALTER TABLE [dbo].[Collect]  WITH CHECK ADD  CONSTRAINT [FK_Collect_User] FOREIGN KEY([UserID])
REFERENCES [dbo].[User] ([ID])
GO
ALTER TABLE [dbo].[Collect] CHECK CONSTRAINT [FK_Collect_User]
GO
ALTER TABLE [dbo].[OrderInfo]  WITH CHECK ADD  CONSTRAINT [FK_OrderInfo_Order] FOREIGN KEY([OrderID])
REFERENCES [dbo].[Order] ([ID])
GO
ALTER TABLE [dbo].[OrderInfo] CHECK CONSTRAINT [FK_OrderInfo_Order]
GO
ALTER TABLE [dbo].[OrderInfo]  WITH CHECK ADD  CONSTRAINT [FK_OrderInfo_Product] FOREIGN KEY([ProductID])
REFERENCES [dbo].[Product] ([ID])
GO
ALTER TABLE [dbo].[OrderInfo] CHECK CONSTRAINT [FK_OrderInfo_Product]
GO
ALTER TABLE [dbo].[Product]  WITH CHECK ADD  CONSTRAINT [FK_Product_ProductType] FOREIGN KEY([TypeID])
REFERENCES [dbo].[ProductType] ([ID])
GO
ALTER TABLE [dbo].[Product] CHECK CONSTRAINT [FK_Product_ProductType]
GO
ALTER TABLE [dbo].[ProductInfo]  WITH CHECK ADD  CONSTRAINT [FK_ProductInfo_Product] FOREIGN KEY([ProductID])
REFERENCES [dbo].[Product] ([ID])
GO
ALTER TABLE [dbo].[ProductInfo] CHECK CONSTRAINT [FK_ProductInfo_Product]
GO
ALTER TABLE [dbo].[Seller]  WITH CHECK ADD  CONSTRAINT [FK_Seller_SellerArea] FOREIGN KEY([AreaID])
REFERENCES [dbo].[SellerArea] ([ID])
GO
ALTER TABLE [dbo].[Seller] CHECK CONSTRAINT [FK_Seller_SellerArea]
GO
ALTER TABLE [dbo].[UserInfo]  WITH CHECK ADD  CONSTRAINT [FK_UserInfo_User] FOREIGN KEY([UserID])
REFERENCES [dbo].[User] ([ID])
GO
ALTER TABLE [dbo].[UserInfo] CHECK CONSTRAINT [FK_UserInfo_User]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'收藏表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Collect'
GO
USE [master]
GO
ALTER DATABASE [Zosnn] SET  READ_WRITE 
GO
